//
//  GKZYBatchQueryBarButtonItemView.m
//  GKZYAid
//
//  Created by tony on 16/3/2.
//  Copyright © 2016年 GKZYAid. All rights reserved.
//

#import "GKZYBatchQueryBarButtonItemView.h"
#import "MyDefine.h"

@implementation GKZYBatchQueryBarButtonItemView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
      
    }
    return self;
}



-(void)setOrangeDirectionWithTitileName:(NSString *)name{

    
    self.titleName = [[UILabel alloc]init];
    self.titleName.text = name;
    CGSize size = [name sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.titleName.font,NSFontAttributeName, nil]];
    self.titleName.frame = CGRectMake(0, 0, size.width, VIEWHEIGHT);
    self.titleName.center = CGPointMake(self.center.x-VIEWWIDTH*0.06, self.center.y-self.frame.origin.y);
    self.titleName.textColor = [UIColor orangeColor];
    self.titleName.userInteractionEnabled = YES;
    self.titleName.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleName];
    
    self.direction = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.titleName.frame), VIEWHEIGHT*0.3, VIEWWIDTH*0.12, VIEWHEIGHT*0.4)];
    self.direction.userInteractionEnabled = YES;
    [self.titleName addSubview:self.direction];
    self.direction.image = [UIImage imageNamed:@"down"];
    
}

-(void)setBlackDirectionWithTitleName:(NSString *)name{
    
    self.titleName = [[UILabel alloc]init];
    self.titleName.text = name;
    CGSize size = [name sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.titleName.font,NSFontAttributeName, nil]];
    self.titleName.lineBreakMode =  NSLineBreakByCharWrapping;
    self.titleName.textColor = [UIColor colorWithRed:178/256.0 green:178/256.0 blue:178/256.0 alpha:1];
    self.titleName.userInteractionEnabled = YES;
    self.titleName.font = [UIFont systemFontOfSize:14];
    self.titleName.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleName];
    if (size.width>VIEWWIDTH) {
        self.titleName.frame = CGRectMake(0, 0, VIEWWIDTH*0.8, VIEWHEIGHT);
        self.direction = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.titleName.frame), VIEWHEIGHT*0.3, VIEWWIDTH*0.12, VIEWHEIGHT*0.4)];
    }else{
        self.titleName.frame = CGRectMake(0, 0, size.width, VIEWHEIGHT);
        self.direction = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.titleName.frame)*0.9, VIEWHEIGHT*0.3, VIEWWIDTH*0.12, VIEWHEIGHT*0.4)];
    }
    self.titleName.center = CGPointMake(self.center.x-VIEWWIDTH*0.06-self.frame.origin.x, self.center.y-self.frame.origin.y);
    self.direction.userInteractionEnabled = YES;
    [self.titleName addSubview:self.direction];
    self.direction.image = [UIImage imageNamed:@"blackdown"];
}

@end
